cmake_minimum_required(VERSION 3.0.0)
project(lnet VERSION 0.1.0 LANGUAGES C CXX)

# c++ 17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# conan config
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

# windows options
if(WIN32)
    add_compile_options(-D_WIN32_WINNT=0x0601)
    add_definitions(/wd4819 /wd4244 /wd4200 /wd4267 /wd4996)
else()
    add_compile_options(-fPIC)
endif()

find_package(Threads REQUIRED)

# add_compile_definitions(ASIO_HAS_CO_AWAIT)
# add_compile_definitions(ASIO_HAS_STD_COROUTINE)
include_directories(.)

add_executable(echo "example/echo.cpp")
add_executable(http "example/http.cpp")
add_executable(ws "example/ws.cpp")

target_link_libraries(echo Threads::Threads)
target_link_libraries(http Threads::Threads ${CONAN_LIBS_LLHTTP})
target_link_libraries(ws Threads::Threads ${CONAN_LIBS_LLHTTP})

if(UNIX)
    target_link_libraries(echo -static-libgcc -static-libstdc++)
    target_link_libraries(http -static-libgcc -static-libstdc++)
    target_link_libraries(ws -static-libgcc -static-libstdc++)
endif()